package Java.Exception;

//异常遇到继承
class OpenExcetion extends java.lang.Exception {
}

class CloseExcetion extends OpenExcetion {
}

class NewException extends java.lang.Exception {
}

public class ExtendException {
    public ExtendException() throws OpenExcetion {
    }

    public void f() throws OpenExcetion {
    }

    public static void main(String[] args) {

    }
}

class NewClass extends ExtendException {

    public NewClass() throws OpenExcetion, NewException {
    }

    public void f() {
    }

    public static void main(String[] args) {
        try {
            ExtendException exception = new NewClass();
        } catch (OpenExcetion e) {
            e.printStackTrace();
        } catch (NewException e) {
            e.printStackTrace();
        }
    }
}
